// 保存缓存
  export const setStorage = (key, value, type = "session") => {
    if (type === "session") {
      setSession( key, value);
    } else {
      setLocal(key, value);
    }
  };

  export const setSession = (key, value) => {
    sessionStorage.removeItem(key);
    sessionStorage.setItem(key, JSON.stringify(value));
  };

// 获取缓存
export const getStorage = (key, type = "session") =>
  type === "session" ? getSession( key) : getLocal(key);

export const getSession = key => {
  const value = sessionStorage.getItem(key);
  return value ? JSON.parse(value) : "";
};